<%@taglib uri="/struts-tags" prefix="s"%>
<script type="text/javascript" charset="utf-8"
	src="js/jquery.listnav.min-2.1.js"></script>
<script type="text/javascript" charset="utf-8"
	src="js/jquery.dataTables.listnav.js"></script>
	
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {

	var organisationId = getURLParameter("organisationId");
	
	// click check box
	$("#check-copy-id").click(function(){
		$.ajax({
			url: 'getAddressOrganisation.action?organisationId='+ organisationId,
			success: function(data){
				$("#addressLine1").val(data.address[0]);
				$("#addressLine2").val(data.address[1]);
				$("#addressLine3").val(data.address[2]);
				$("#postcode").val(data.address[3]);
				$("#city").val(data.address[4]);
				$("#county").val(data.address[5]);
				$("#selsear").val(data.address[6]);	
			}
		});
	
	});
	});
	//Get URL Parameter
	function getURLParameter(name) {
	    return decodeURI(
	        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
	    );
	}
</script>
	
	
<div class="content">
	<div class="row-fluid">
	<form action="createDirectorate.action?organisationId=<s:property value='organisationId'/>" class='validate form-horizontal' method="post">
		<div class="span12">
			<div class="box">
				<div class="box-head tabs">
					<div style="width: 273px;">
						<h3>Business Unit/Directorate Details</h3>
					</div>
					<div style="float: right;">
						<ul style="list-style: none; margin: 10px 0 0 0;">
							<li style="float: left; margin-right: 10px;"><button class="btn btn-success" type="submit">Save</button></li>
							<li style="float: left; margin-right: 10px;"><a id=""
								href="createDirectorate.action?organisationId=<s:property value='organisationId'/>" class="btn btn-success">Back</a></li>
						</ul>
					</div>
				</div>
				<div class="box-content" id="directorate">
					<div class="tab-content">
						<div class="tab-pane active" id="0">
								<div class="row-fluid force-margin">
									<div class="span3">
										<div class="control-group">
											<label for="req" class="control-label require">BU/Directorate
												Name</label>
											<div class="controls">
												<input type="text" name="directorateName" id="req"
													class='required'>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">BU/Directorate
												Short Description</label>
											<div class="controls">
												<textarea style="resize: none; width: 219px;"
													name="directorateShortDescription" id="basictext"
													class='span9 input-square' rows="6"></textarea>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Lead Contact</label>
											<div class="controls">
												<input type="hidden" name="leadContactId" id="contact-id" class='input-medium input-square' readonly="readonly" value=""> 
												<input type="text" name="leadContactName" id="contact-name" class='input-medium input-square' readonly="readonly" value=""> 
												<a id="lookup-contact" data-toggle="modal" href="#lookUpContact">Lookup</a>
											</div>
										</div>
										<div class="control-group">
											 <div class="controls">
											 	<label class="checkbox">
													<input id="check-copy-id" class="uniform" type="checkbox" name="check-copy">
													Copy Address from Organisation
												</label>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label require">Address Line 1</label>
											<div class="controls">
												<input type="text" name="addressLine1" id="addressLine1">
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Address Line 2</label>
											<div class="controls">
												<input type="text" name="addressLine2" id="addressLine2">
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Address Line 3</label>
											<div class="controls">
												<input type="text" name="addressLine3" id="addressLine3">
											</div>
										</div>
										<div class="control-group">
											<label for="email3" class="control-label require">Postcode</label>
											<div class="controls">
												<input type="text" name="postcode" id="postcode" class='input-medium input-square' value=""> 
												<a class="" id="lookup-postcode" data-toggle="modal" href="#lookUpPostcode">Lookup</a>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Town/Village/City</label>
											<div class="controls">
												<input type="text" name="city" id="city">
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">County</label>
											<div class="controls">
												<input type="text" name="county" id="county">
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Nation/Country</label>
											<div class="controls">
												<s:select list="countries" name="country"
													listKey="countryId" listValue="countryName" id="selsear"
													headerKey="-1" required="true" headerValue="">
												</s:select>
											</div>
										</div>
									</div>
									<div class="span3">						
										<div class="control-group">
										<label for="req" class="control-label">Type of
											Business</label>
										<div class="controls">
											<input type="hidden" name="businessId" id="businessIdHidden"
												class='input-medium input-square' readonly="readonly"
												value=""> <input type="text" name="businessName"
												id="txtBussinessName" class='input-medium input-square'
												readonly="readonly" value="">
												<a id="look-up" data-toggle="modal" href="#lookUpBusiness">Lookup</a>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">SIC Code</label>
											<div class="controls">
												<input style="width: 50px;" type="text" name="sICCode"
													id="txtSICCode" class='input-medium input-square'
													readonly="readonly" value="">
											</div>
										</div>
										<div class="control-group">
											<label for="check" class="control-label">BU/Directorate
												Full Description</label>
											<div class="controls">
												<textarea style="resize: none; width: 219px;"
													name="directorateFullDescription" id="basictext"
													class='span9 input-square' rows="6"></textarea>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Phone Number</label>
											<div class="controls">
												<input type="text" name="phoneNumber" id="req"
													class='required'>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Fax</label>
											<div class="controls">
												<input type="text" name="fax" id="req" class='required'>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Email</label>
											<div class="controls">
												<input type="text" name="email" id="req" class='required'>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Web Address</label>
											<div class="controls">
												<input type="text" name="webAddress" id="req"
													class='required'>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Charity Number</label>
											<div class="controls">
												<input type="text" name="charityNumber" id="req"
													class='required'>
											</div>
										</div>
										<div class="control-group">
											<label for="req" class="control-label">Company Number</label>
											<div class="controls">
												<input type="text" name="companyNumber" id="req"
													class='required'>
											</div>
										</div>
									</div>
								</div>
						</div>										 
					</div>
				</div>
				
			</div>
		</div>
		</form>
	</div>
</div>
<!-- Lookup -->
<!-- BusinessType -->
<div id="pageLookupBusinessType"> 
	<%@ include file="LookupBusinessType.jsp" %>
</div>

<!-- Contact -->

<div id="pageLookUpContact"> 
	<%@ include file="lookUpContact.jsp" %>
</div>

<!-- Postcode -->
<div id="pageLookupPostcode">
	<%@ include file="lookUpPostcode.jsp" %>
</div>